package com.example.spring;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class BeanProxy implements ApplicationContextAware {

	private static ApplicationContext context = null;

	public void setApplicationContext(ApplicationContext arg0)
			throws BeansException {
		// 初始化 ApplicationContext
		context = arg0;
	}

	public static Object getBean(String key) {
		return context.getBean(key);
	}

}